import { API_CONFIG } from "../config/index.js";
import request from "../api/index.js";
const BASE_URL = import.meta.env.VITE_BASE_URL;
export const deleteHandler = (clusterId, namespace, name,resourceType) => {
    const resourceTypeTemp = resourceType.toLowerCase()
    const url = `${BASE_URL}/${resourceTypeTemp}/delete`
    return request(url, {clusterId, namespace, name}, "post", "2000")
}

export const listHandler = (clusterId, namespace,resourceType) => {
    const resourceTypeTemp = resourceType.toLowerCase()
    const url = `${BASE_URL}/${resourceTypeTemp}/list`
    return request(url, {clusterId, namespace}, "get", "2000")
}

export const restartHandler = (clusterId, namespace,resourceType,name) => {
    const resourceTypeTemp = resourceType.toLowerCase()
    const url = `${BASE_URL}/${resourceTypeTemp}/restart`
    return request(url, {clusterId, namespace,name}, "get", "2000")
}

export const updateHandler = (clusterId, namespace, name,resourceType,item) => {
    const resourceTypeTemp = resourceType.toLowerCase()
    const url = `${BASE_URL}/${resourceTypeTemp}/update`
    return request(url, {clusterId, namespace, name,item}, "post", "2000")
}